﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using QuickStart.Properties;

namespace QuickStart.Forms
{
    public partial class RunForm : Form
    {
        private RunForm()
        {
            InitializeComponent();

            this.Icon = Resources.QuickStartIcon;
        }

        private void textBox1_KeyUp(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.Enter:
                    StartInfo si = StartInfo.GetInstance();
                    si.Run(this.textBox1.Text.Trim());
                    this.textBox1.Text = "";
                    this.Hide();
                    break;

                case Keys.Escape:
                    this.textBox1.Text = "";
                    this.Hide();
                    break;

                default:
                    break;

            }
        }

        private static RunForm instance;

        public static RunForm GetInstance()
        {
            if (instance == null)
            {
                instance = new RunForm();
            }

            return instance;
        }
    }
}
